<%@page contentType= "text/html;charset=UTF-8" %>
<%@include file="/include/include.jsp"%>
<wst:jspns/>
<script type="text/javascript">
	$(document).ready(function(){
	
		var newAction = function(){

			//弹出窗口
			$("#${jspns}newWindow").omDialog({
				height: 350,
				title:'新增用户',
				modal: true
			});
			//加载窗口内容
			$("#${jspns}newPanel").omPanel({
        width: 'fit',
        height: '100%',
        header:false,
        url:'<wst:webRoot/>/usermanagement/UserController/doNew.do?parentJspns=${jspns}'
    	});
		
		};
		 
	
	
		 //设置表格
		 var dataGrid = $('#${jspns}dataGrid');
		 dataGrid.omGrid({
               showIndex : false,
               singleSelect:false,
               method:'POST',
               dataSource : '<wst:webRoot/>/usermanagement/UserController/doGridData.do',
               limit:4,
               colModel :[ {header : '用户名', name : 'username', width : 100, align : 'center'}]
     });
     
     //高级查询
     var advancedQueryFormPanel = $("#${jspns}advancedQueryFormPanel").omPanel({
       width:	'fit',
       height:'180px',
       header: false,
       collapsed:true
   	});
   	
   	//工具栏
   	$('#${jspns}buttonbar').omButtonbar({
			width : 'fit',
			btns : [
				{label:"新增",
      	id:"button1" ,
				onClick:newAction
				}
			]
		});
   	
		
		//绑定事件
   	$("#${jspns}showAdvancedQueryBtn").toggle(
   		function(){
       advancedQueryFormPanel.omPanel("expand");
       $(this).val("收起高级查询");
   		},
   		function(){
       advancedQueryFormPanel.omPanel("collapse");
       $(this).val("高级查询");
   		}
   	);
   	
   	var keywordQuery = function(){
   		$('#${jspns}actionType').val('searchKeyWord');
			dataGrid.omGrid('orzSetData','#${jspns}queryForm');
   	};
   	
   	$("#${jspns}queryBtn").click(keywordQuery);
   	
   	var advancedQueryFn = function(){
   		$('#${jspns}actionType').val('advancedQuery');
			dataGrid.omGrid('orzSetData','#${jspns}queryForm');
   	};
   	
   	var hideAdvancedQueryPanelFn = function(){
   		$("#${jspns}showAdvancedQueryBtn").removeAttr("disabled");
   		advancedQueryFormPanel.omPanel('collapse');
   		
   	};
   	
   	var cleanAdvancedQueryFormFn = function(){
   		$("#${jspns}username").val('');
   	}
   	
   	//高级查询并收起
   	$("#${jspns}advancedQueryAndHideBtn").click(function(){
   			 hideAdvancedQueryPanelFn();
   			 advancedQueryFn();	
   	});
   	
   	$('#${jspns}searchKeyWord').bind('keyup', function(event){
   		if (event.keyCode=="13"){
    		keywordQuery();
   		}
		});
   	
   	//查询
   	$("#${jspns}advancedQueryBtn").click(advancedQueryFn);
   	
   	//清空
   	$("#${jspns}cleanAdvancedQueryBtn").click(cleanAdvancedQueryFormFn);
   	
   	//隐藏
   	$("#${jspns}hideAdvancedQueryBtn").click(hideAdvancedQueryPanelFn);
   	
   	
   	 
	});
	
</script>
<form id="${jspns}queryForm" >
<div id="${jspns}buttonbar">
	<input id="${jspns}actionType" name="actionType" type="hidden"/>
	<span style="float: right;">
	<input id="${jspns}searchKeyWord" name="searchKeyWord"/>
	<input id="${jspns}queryBtn" type="button" value="查询" />
	<input id="${jspns}showAdvancedQueryBtn" type="button" value="高级查询" />
	</span>
</div>
<div id="${jspns}advancedQueryFormPanel" style="display: none">
		用户名：<input id="${jspns}username" name="user.username"/>
		<br/>
		
		<input id="${jspns}advancedQueryAndHideBtn" type="button" value="查询并收起" />
		<input id="${jspns}advancedQueryBtn" type="button" value="查询" />
		<input id="${jspns}cleanAdvancedQueryBtn" type="button" value="清空" />
		<input id="${jspns}hideAdvancedQueryBtn" type="button" value="收起" />
</div>
<table id="${jspns}dataGrid"></table>
</form>

<!-- 新增 -->
<div id="${jspns}newWindow">
	<div id="${jspns}newPanel"></div>
</div>
<!-- 编辑 -->
<div id="${jspns}editForm"></div>
<!-- 修改密码-->
<div id="${jspns}changePasswordForm"></div>
<!-- 设置权限-->
<div id="${jspns}setPermissionForm"></div>
